using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Threading.Tasks;

namespace AvalonAdmin.BaseViewModel
{
    /// <summary>
    /// 数据视图模型接口
    /// </summary>
    /// <typeparam name="T">数据类型</typeparam>
    public interface IDataViewModel<T> : INotifyPropertyChanged
    {
        /// <summary>
        /// 数据集合
        /// </summary>
        ObservableCollection<T>? Data { get; set; }

        /// <summary>
        /// 选中的模型
        /// </summary>
        T? SelectedModel { get; set; }

        /// <summary>
        /// 是否正在加载
        /// </summary>
        bool IsLoading { get; set; }

        /// <summary>
        /// 是否有数据
        /// </summary>
        bool HasData { get; }

        /// <summary>
        /// 是否有选中的模型
        /// </summary>
        bool HasSelectedModel { get; }

        /// <summary>
        /// 查询数据
        /// </summary>
        /// <returns></returns>
        Task QueryAsync();

        /// <summary>
        /// 重置查询条件
        /// </summary>
        void Reset();
    }
}